package com.srwl.mytx.domain;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Date;

public class Transfer implements Parcelable {
    private String id;

    private String uId;

    private String aliUid;

    private String adminId;

    private String aliAccount;

    private Double amount;

    private String orderId;

    private Integer status;

    private Date payDate;

    private Date updateDate;

    private Date createDate;

    private User targetUser; //提现订单关联的用户信息

    public Transfer(String id, String uId, String aliUid, String adminId, String aliAccount, Double amount, String orderId, Integer status, Date payDate, Date updateDate, Date createDate) {
        this.id = id;
        this.uId = uId;
        this.aliUid = aliUid;
        this.adminId = adminId;
        this.aliAccount = aliAccount;
        this.amount = amount;
        this.orderId = orderId;
        this.status = status;
        this.payDate = payDate;
        this.updateDate = updateDate;
        this.createDate = createDate;
    }

    public Transfer() {
        super();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getuId() {
        return uId;
    }

    public void setuId(String uId) {
        this.uId = uId;
    }

    public String getAliUid() {
        return aliUid;
    }

    public void setAliUid(String aliUid) {
        this.aliUid = aliUid;
    }

    public String getAdminId() {
        return adminId;
    }

    public void setAdminId(String adminId) {
        this.adminId = adminId;
    }

    public String getAliAccount() {
        return aliAccount;
    }

    public void setAliAccount(String aliAccount) {
        this.aliAccount = aliAccount;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getPayDate() {
        return payDate;
    }

    public void setPayDate(Date payDate) {
        this.payDate = payDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public User getTargetUser() {
        return targetUser;
    }

    public void setTargetUser(User targetUser) {
        this.targetUser = targetUser;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.uId);
        dest.writeString(this.aliUid);
        dest.writeString(this.adminId);
        dest.writeString(this.aliAccount);
        dest.writeValue(this.amount);
        dest.writeString(this.orderId);
        dest.writeValue(this.status);
        dest.writeLong(this.payDate != null ? this.payDate.getTime() : -1);
        dest.writeLong(this.updateDate != null ? this.updateDate.getTime() : -1);
        dest.writeLong(this.createDate != null ? this.createDate.getTime() : -1);
        dest.writeParcelable(this.targetUser, flags);
    }

    protected Transfer(Parcel in) {
        this.id = in.readString();
        this.uId = in.readString();
        this.aliUid = in.readString();
        this.adminId = in.readString();
        this.aliAccount = in.readString();
        this.amount = (Double) in.readValue(Double.class.getClassLoader());
        this.orderId = in.readString();
        this.status = (Integer) in.readValue(Integer.class.getClassLoader());
        long tmpPayDate = in.readLong();
        this.payDate = tmpPayDate == -1 ? null : new Date(tmpPayDate);
        long tmpUpdateDate = in.readLong();
        this.updateDate = tmpUpdateDate == -1 ? null : new Date(tmpUpdateDate);
        long tmpCreateDate = in.readLong();
        this.createDate = tmpCreateDate == -1 ? null : new Date(tmpCreateDate);
        this.targetUser = in.readParcelable(User.class.getClassLoader());
    }

    public static final Creator<Transfer> CREATOR = new Creator<Transfer>() {
        @Override
        public Transfer createFromParcel(Parcel source) {
            return new Transfer(source);
        }

        @Override
        public Transfer[] newArray(int size) {
            return new Transfer[size];
        }
    };
}